<?php

class cache_engine_eaccelerator implements iCacheControllerBackend {
	
	public function __construct () {}
	
	public function get (array $params) {
		$result = eaccelerator_get(md5 ($params['key']));
		if ($result) {
			return unserialize ($result);
		} else {
			return false;
		}
	}
	
	public function getArray (array $params) {
		return $this->get ($params);
	}
	
	public function getObject (array $params) {
		return $this->get ($params);
	}
	
	public function set (array $params) {
		eaccelerator_put (md5 ($params['key']), serialize ($params['value']), $params['lifetime']);
	}
	
	public function setArray (array $params) {
		$this->set ($params);
	}
	
	public function setObject (array $params) {
		$this->set ($params);
	}
	
	public function delete (array $params) {
		eaccelerator_rm (md5 ($params['key']));
	}
	
}